package com.cdd.index.controller;

import com.cdd.index.service.ILinkService;
import com.common.entity.HeadNav;
import com.common.entity.Link;
import com.common.untils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lzl
 * @since 2022-09-06
 */
@RestController
@RequestMapping("/index/link")
public class LinkController {
    @Autowired
    private ILinkService linkService;
    @PostMapping("/selectAll/{currentPage}/{pageSize}")
    public CommonResult selectAll(@PathVariable Integer currentPage, @PathVariable Integer pageSize, @RequestBody Link link){
       // System.out.println("-------------------------"+link);
        return linkService.selectAll(currentPage,pageSize,link);
    }
    @PostMapping("/findAll")
    public CommonResult findAll(){
        return linkService.findAll();
    }
    @PostMapping("/updateStatus/{linkId}/{isDisable}")
    public CommonResult updateStatus(@PathVariable String linkId,@PathVariable Integer isDisable){
        return linkService.updateStatus(linkId,isDisable);
    }

    @PostMapping("/linkAdd")
    public CommonResult linkAdd(@RequestBody Link link){
        return linkService.linkAdd(link);
    }
    @PostMapping("/updateLink")
    public CommonResult update(@RequestBody Link link){
        return linkService.updateLink(link);
    }

    @PostMapping("/deleteLink/{linkId}")
    public CommonResult deleteLink(@PathVariable String linkId){
        return linkService.deleteLink(linkId);
    }
}
